<h2 class="title">Liste der Umlenker</h2>

<div class="content"> <!-- Content start -->

<%= link_to 'Neuer Umlenker', new_chain_path if @user.is_schorsch? %>
<table>
  <tr>
    <th>Nummer</th>
    <th>Wandteil</th>
    <th>Wandteil-name</th>
    <th>Anzahl Routen</th>
    <th>Leichteste Route</th>
    <th>Schwerste Route</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @chains.each do |chain| %>
  <tr>
    <td><%= chain.number %></td>
    <td><%= chain.wall.number.to_s %></td>
    <td><%= chain.wall.name %></td>
    <td><%= chain.routes.size %></td>
    <td><%= chain.routes.sort{|x, y| x.grade <=> y.grade}.first.grade.grade if chain.routes.size > 0 %></td>
    <td><%= chain.routes.sort{|x, y| y.grade <=> x.grade}.first.grade.grade if chain.routes.size > 0 %></td>

    <td><%= link_to 'Anzeigen', chain %></td>
    <td><%= link_to 'Editieren', edit_chain_path(chain)  if @user.is_schorsch? %></td>
    <td><%= link_to 'Loeschen', chain, :confirm => 'Are you sure?', :method => :delete if @user.is_schorsch? %></td>
  </tr>
<% end %>
</table>

<br />

</div>
